package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Scenic;
import cn.wolfcode.trip.base.mapper.ScenicMapper;
import cn.wolfcode.trip.base.query.ScenicQuery;
import cn.wolfcode.trip.base.service.IScenicService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ScenicServiceImpl implements IScenicService{

    @Autowired
    private ScenicMapper scenicMapper;


    @Override
    public PageInfo query(ScenicQuery qo) {
        qo.setOrderBy("s.place_id");
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize(),qo.getOrderBy());
        List<Scenic> list = scenicMapper.selectForList(qo);
        return new PageInfo(list);
    }

    @Override
    public Scenic selectById(Long id) {
        return scenicMapper.selectByPrimaryKey(id);
    }
}
